package com.sen.paydemo.controller;


import com.sen.paydemo.config.WxPayConfig;
import com.sen.paydemo.vo.ApiResult;
import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.service.partnerpayments.nativepay.NativePayService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "测试")
@RestController
@RequestMapping("/api/test")
public class TestController extends BaseController{

    @Resource
    private WxPayConfig wxPayConfig;

    @GetMapping
    public ApiResult getWxPayConfig(){

        System.out.println(wxPayConfig);
        return success(wxPayConfig.getAppid());
    }


    @GetMapping("/pay")
    public ApiResult pay(){
        // 使用自动更新平台证书的RSA配置 验签
       // Config config = wxPayConfig.getConfig();

        // 构建service
       // NativePayService service = new NativePayService.Builder().config(config).build();
        System.out.println(wxPayConfig);
        return success(wxPayConfig.getAppid());
    }
}
